<template>
    <div>
   <div>
        <el-row class="home">
     <el-col :span="16">
        <el-carousel :interval="2000" type="card" height="350px" indicator-position="none">
        <el-carousel-item v-for="item in banners" :key="item.a">
        <img :src="item.image" alt="">
        </el-carousel-item>
        </el-carousel>
     </el-col>
     <el-col :span="8">
         <el-col :span="8" >
           <girls></girls>
         </el-col>
     </el-col>
    </el-row>
   </div>
   <div>
       <el-row>
  <el-col :span="6" v-for="(item, index) in list" :key="index" class="card">
    <el-card :body-style="{ padding: '20px' }">
      <img :src="item.images[0].startsWith('https') ? item.images[0] : 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png'" class="image">
      <div style="padding: 14px;">
        <div class="descs">{{item.desc}}</div>
        <div class="bottom clearfix">
          <time class="time">{{item.createdAt}}</time>
          <router-link :to="{name:'article',params:{id:item._id}}">
              <el-button type="text" class="button">详情</el-button>
          </router-link>
          
        </div>
      </div>
    </el-card>
  </el-col>
</el-row>
   </div>
    </div>
</template>

<script>
import {mapState,mapActions} from 'vuex'
// import axios from 'axios'
import girls from '../components/girls.vue';
export default {
  components: { girls },
    name: 'VueHome1',

    

    data() {
        return {
            // banners:[],
            // list:[],
            girls:[],
        };
    },
    computed:{
      ...mapState(['banners','list']),
      // ...mapState(['list'])
    },

    created() {
      this.getbanners()
      this.getlist()
      //  this.$store.dispatch('getbanners')
        
        
    },

    methods: {
      ...mapActions(['getbanners','getlist']),
      // ...mapActions(['getlist']),
    },
};
</script>

<style  scoped>


.el-carousel__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }
  
  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }

  .time {
    font-size: 13px;
    color: #999;
  }
  
  .bottom {
    margin-top: 13px;
    line-height: 12px;
  }

  .button {
    padding: 0;
    float: right;
  }

  .image {
     height: 200px; 
    width: 100%;
    display: block;
  }

  .clearfix:before,
  .clearfix:after {
      display: table;
      content: "";
  }
  
  .clearfix:after {
      clear: both
  }
  .descs{
      height: 50px;
      line-height: 25px;
      overflow: hidden;
  }
   

</style>